<?php
require '../conn.php';
require 'config.php';
require '../inc/function.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/admin.css" type="text/css" />
<script type="text/javascript" src="inc/function.js"></script>
<script type="text/javascript" src="../fy_ckeditor/ckeditor.js"></script>
</head>
<body>
<?php
$exhid=$_GET['exhid'];
$urls.='&exhid='.$exhid;
if ($act=='add'){
	$p_class=ReStra($_POST['p_class']);
	$p_order=ReStra($_POST['p_order']);
	$p_name=ReStra(trim($_POST['p_name']));
	$p_image=ReStra($_POST['p_image']);
	$p_thumb=GetThumbPath($p_image);

	CreateThumbs($p_image,220,165,0,$p_thumb);
	$sql="insert into ".$language."_photos(p_exhid,p_class,p_order,p_name,p_image,p_thumb) values($exhid,$p_class,$p_order,'$p_name','$p_image','$p_thumb')";
	mysql_query($sql) or die(mysql_error($sql));
	Msg('添加图片成功！','PageUrl');
}
$class_name=RsField('select e_name from '.$language.'_exhibition_class where e_id='.$exhid);
?>
<div id="container">
  <div class="edit">
      <h1>展会现场照片 - <?php echo $class_name ?><a href="javascript:location.reload();">刷新</a></h1>
      <form name="form1" method="post" action="?act=add&exhid=<?php echo $exhid ?>" onsubmit="return CheckPhotos(this);">
        <table id="protbe" width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td class="edit_title">图片分类：</td>
            <td><select name="p_class" class="input_select"><option value="">请选择</option><?php
			$str='';
			$query2=mysql_query('select * from '.$language.'_photos_class where p_exhid='.$exhid.' order by p_order,p_id');
			if(mysql_num_rows($query2)>0){
			while($row2=mysql_fetch_array($query2)){
				$str.='<option value="'.$row2['p_id'].'">'.$row2['p_name'].'</option>';
			}
			}
			echo $str;
			?></select></td>
          </tr>
          <tr>
            <td class="edit_title">图片名称：</td>
            <td><input type="text" name="p_name" class="inputtext" size="50" maxlength="50" /></td>
          </tr>
          <tr>
            <td class="edit_title">上传图片：</td>
            <td><input type="text" name="p_image" id="p_image" class="inputtext" size="50" readonly="readonly" />&nbsp;(图片宽高比例4:3，最小尺寸：220*165)<iframe src="../upload_fy.php?file_type=0&file_id=p_image" frameborder="0" allowtransparency="true" scrolling="no" width="100%" height="25"></iframe></td>
          </tr>
          <tr>
            <td class="edit_title">图片排序：</td>
            <td><input type="text" name="p_order" id="p_order" class="inputtext" value="<?php echo RsNum('select p_id from '.$language.'_photos where p_exhid='.$exhid)+1 ?>" size="10" maxlength="10" /></td>
          </tr>
          <tr>
            <td class="edit_title" height="30">&nbsp;</td>
			<td><input type="submit" name="button" class="button" value=" 添加 " /></td>
          </tr>
        </table>
    </form>
    </div>
</div>
</body>
</html>